home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctutor2.zip / READCHAR.C < prev    next >
C/C++ Source or Header  |  1987-07-04  |  480b  |  20 lines

  1.                                          /* Chapter 10 - Program 3 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r");
  10.  
  11.    if (funny == NULL) printf("File doesn't exist\n");
  12.    else {
  13.       do {
  14.          c = getc(funny);    /* get one character from the file */
  15.          putchar(c);         /* display it on the monitor       */
  16.       } while (c != EOF);    /* repeat until EOF (end of file)  */
  17.    }
  18.    fclose(funny);
  19. }
  20.